package cn.iocoder.yudao.module.biz.dal.mysql.emergencyRanks;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.emergencyRanks.BizEmergencyRanksDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.emergencyRanks.vo.*;

/**
 * 应急队伍 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizEmergencyRanksMapper extends BaseMapperX<BizEmergencyRanksDO> {

    default PageResult<BizEmergencyRanksDO> selectPage(BizEmergencyRanksPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizEmergencyRanksDO>()
                .likeIfPresent(BizEmergencyRanksDO::getName, reqVO.getName())
                .eqIfPresent(BizEmergencyRanksDO::getDuty, reqVO.getDuty())
                .eqIfPresent(BizEmergencyRanksDO::getDepartment, reqVO.getDepartment())
                .eqIfPresent(BizEmergencyRanksDO::getJobTitle, reqVO.getJobTitle())
                .eqIfPresent(BizEmergencyRanksDO::getEstablished, reqVO.getEstablished())
                .eqIfPresent(BizEmergencyRanksDO::getPersonnel, reqVO.getPersonnel())
                .betweenIfPresent(BizEmergencyRanksDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizEmergencyRanksDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizEmergencyRanksDO::getId));
    }

    default List<BizEmergencyRanksDO> selectList(BizEmergencyRanksExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizEmergencyRanksDO>()
                .likeIfPresent(BizEmergencyRanksDO::getName, reqVO.getName())
                .eqIfPresent(BizEmergencyRanksDO::getDuty, reqVO.getDuty())
                .eqIfPresent(BizEmergencyRanksDO::getDepartment, reqVO.getDepartment())
                .eqIfPresent(BizEmergencyRanksDO::getJobTitle, reqVO.getJobTitle())
                .eqIfPresent(BizEmergencyRanksDO::getEstablished, reqVO.getEstablished())
                .eqIfPresent(BizEmergencyRanksDO::getPersonnel, reqVO.getPersonnel())
                .betweenIfPresent(BizEmergencyRanksDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizEmergencyRanksDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizEmergencyRanksDO::getId));
    }

}
